{% extends "base.html" %}
{% block header %}
{% endblock %}

{% block menu %}
   {% include 'monitor-menu.html' %}
{% endblock %}


{% block content %}
<div id="mon-tit">
    {% if curhost %}
    <div class="left">暴风服务监控 >> 监控项目添加 >> {{curhost.hid}}</div>
    {% else %}
    <div class="left">暴风服务监控 >> 监控项目添加</div>
    {% endif %}
</div>
    <div class="clr"></div>
    <hr>
    <h3 class='tit'>添加新监控</h3>
    {% if errors %}
        <ul>
            {% for error in errors %}
            <li>{{ error }}</li>
            {% endfor %}
        </ul>
    {% endif %}
	{% if messages %}
		{% for message in messages %}
			{% if message == "addsuccess" %}
				<script language=javascript>alert('添加监控信息成功!!');window.location.href='/monitor';</script>
			{% endif %}
		{% endfor %}
	{% endif %}
    <table width="100%">
		<form name="form1" method="post" action="../addmonitor/" >
			监控名称：&nbsp;&nbsp;<input type="text" name="mname" >&nbsp;&nbsp;&nbsp;&nbsp;[为你要监控的服务起一个名字]</br></br>
			监控URL：&nbsp;&nbsp;<input type="text" name="url">&nbsp;&nbsp;&nbsp;&nbsp;[输入你要监控的链接]</br></br>
			监控模版：&nbsp;
			<select name="tpl" >
			<option value =""></option>
			<option value ="http">- Http -</option>
			<option value ="apache">- Apache -</option>
			<option value ="port">- Port -</option>
			<option value ="nginx">- Nginx -</option>
			</select>&nbsp;&nbsp;&nbsp;&nbsp;[选择监控服务的模版 http|apache|port|nginx]</br></br>
			监控频率：&nbsp;&nbsp;<input type="text" name="freq" value="60">&nbsp;&nbsp;&nbsp;&nbsp;[对应服务的监控频率 请输入数字（单位：S）]</br></br>
			警报频率：&nbsp;&nbsp;<input type="text" name="alert_count" value="3">&nbsp;&nbsp;&nbsp;&nbsp;[提醒相关服务人的警报出现次数]</br></br>
			选择产品：&nbsp;&nbsp;
			<select name="product" >
            {% if curhost %}
			    <option value ="{{curhost.pid.id}}">{{ curhost.pid}}</option>
            {% else %}
			    {% for l in list %}
			        <option value ="{{l.id}}">{{l.pname}}</option>
			    {% endfor %}
            {% endif %}
			</select>&nbsp;&nbsp;&nbsp;&nbsp;[请选择你所监控的服务]
			</br></br>
			对应主机：&nbsp;&nbsp;
			<select name="host">
            {% if curhost %}
			    <option value ="{{curhost.hid.id}}">{{curhost.hid.name}}</option>
            {% else %}
			    {% for l in list2 %}
			    <option value ="{{l.id}}">{{l.hname}}</option>
			    {% endfor %}
            {% endif %}
			</select>&nbsp;&nbsp;&nbsp;&nbsp;[选择对应的主机]
			</br></br>
			报警方式：&nbsp;&nbsp;
			<input name="mode" type="checkbox" value="0" checked=true/> Mail&nbsp;&nbsp;
			<input name="mode" type="checkbox" value="1" checked=true/> 短信&nbsp;&nbsp;
			<input name="mode" type="checkbox" value="2"/> Gtalk&nbsp;&nbsp;
			<input name="mode" type="checkbox" value="3"/> MSN&nbsp;&nbsp;
            </br>
            </br>
			通知用户：&nbsp;&nbsp;</br>
            <div class="alert-user">
			    {% for l in list1 %}
				<label class="floating"><input name="user" type="checkbox" value="{{l.user_id}}"/>&nbsp;&nbsp;{{ l.user }}</label>
			    {% endfor %}
            </div>
            <div class="clr"></div>
			</br>
			<div style="text-align:center"><input type="submit"  value="提交新监控"></div>
		</form>
   </table>
{% endblock %}
